package com.hexb.smh.entity.param.config;

import com.hexb.core.utils.MapBuilder;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.validation.constraints.Pattern;

import java.math.BigDecimal;
import java.util.Map;

import static com.hexb.smh.utils.SmhConstant.AMOUNT_PATTERN;
import static com.hexb.smh.utils.SmhConstant.RATE_PATTERN;

/**
 * @author : hexb
 */
@Data
public class ExpressionValidParam {
    @ApiModelProperty("套餐固定成本率")
    @Pattern(regexp = AMOUNT_PATTERN)
    private String fixedCostPrice;

    @ApiModelProperty("套餐变动成本率")
    @Pattern(regexp = AMOUNT_PATTERN)
    private String volatileCostPrice;

    @ApiModelProperty("套餐其它成本率")
    @Pattern(regexp = AMOUNT_PATTERN)
    private String otherCostPrice;

    @ApiModelProperty("套餐折扣率")
    @Pattern(regexp = AMOUNT_PATTERN)
    private String marketPrice;

    @ApiModelProperty("业务员提成率")
    @Pattern(regexp = RATE_PATTERN)
    private String commission;

    public Map<String, Object> toContext() {
        return MapBuilder.<String,Object>create("A", new BigDecimal(fixedCostPrice))
                .build("B", new BigDecimal(volatileCostPrice))
                .build("C", new BigDecimal(otherCostPrice))
                .build("D", new BigDecimal(marketPrice))
                .build("E", new BigDecimal("0.15"))
                .map();
    }

}
